package com.example.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AbsListView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.Base.BasePersonActivity;
import com.example.administrator.olddoctor.R;

public class FindDetailActivity extends AppCompatActivity implements View.OnClickListener{

    private ListView lv;

    private ImageView back;
    private LinearLayout invis;
    private TextView tv_tab_find1,tv_tab_find2,tv_tab_find3,tv_tab_find4;

    private String[] strs;
    private String[] strss;

    private Button button_zhui;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_finddetail);
//        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//        toolbar.setTitle("发现详情页");
//
//        setSupportActionBar(toolbar);

        invis = (LinearLayout) findViewById(R.id.invis);
        back = (ImageView) findViewById(R.id.imageView_back);

        button_zhui = (Button) findViewById(R.id.button_zhui);

        tv_tab_find1 = (TextView) findViewById(R.id.tv_tab_find1);
        tv_tab_find2 = (TextView) findViewById(R.id.tv_tab_find2);
        tv_tab_find1.setOnClickListener(this);
        tv_tab_find2.setOnClickListener(this);
        back.setOnClickListener(this);

        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

//        button_zhui.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Toast.makeText(FindDetailActivity.this,"点击了追姐",Toast.LENGTH_SHORT).show();
//            }
//        });

        strs = new String[100];
        strss = new String[100];

        for (int i = 0; i < 100; i++) {
            strs[i] = "data-----" + i;
        }

        for (int i = 100; i >0; i--) {
            int j = 0;
            strss[j] = "data-----" + i;
            j++;
        }

        lv = (ListView) findViewById(R.id.lv);
        View header = View.inflate(this, R.layout.stick_header, null);//头部内容
        lv.addHeaderView(header);//添加头部
        lv.addHeaderView(View.inflate(this, R.layout.stick_action, null));//ListView条目中的悬浮部分 添加到头部

        lv.setAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, strs));
        lv.setOnScrollListener(new AbsListView.OnScrollListener() {

            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {

            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem,int visibleItemCount, int totalItemCount) {
                if (firstVisibleItem >= 1) {
                    invis.setVisibility(View.VISIBLE);
                } else {

                    invis.setVisibility(View.GONE);
                }
            }
        });



    }


    @Override
    public void onClick(View v) {

       /* switch (v.getId()){
            case R.id.tv_tab_find1:
                lv.setAdapter(null);
                lv.setAdapter(new ArrayAdapter<String>(this,
                        android.R.layout.simple_list_item_1, strs));
                break;
            case R.id.tv_tab_find2:
                lv.setAdapter(null);
                lv.setAdapter(new ArrayAdapter<String>(this,
                        android.R.layout.simple_list_item_1, strss));
                break;
        }*/
    }
}
